<%@page contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>当当图书 – 全球最大的中文网上书店</title>
		<link href="../css/book.css" rel="stylesheet" type="text/css" />
		<link href="../css/second.css" rel="stylesheet" type="text/css" />
		<link href="../css/secBook_Show.css" rel="stylesheet" type="text/css" />
		<link href="../css/shopping_vehicle.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/jquery-1.4.3.js"></script>
				<script type="text/javascript" src="../js/check_login.js"></script>
		<script type="text/javascript">
			$(function(){
				var carts='${carts}';
				var dels = '${dels}';
				
				if (carts == '[]'){
					$("#div_choice").removeClass("choice_merch").addClass("objhide");
					$("#div_no_choice").removeClass("objhide").addClass("choice_bord");
				}else{
					$("#div_choice").removeClass("objhide").addClass("choice_merch");
					$("#div_no_choice").removeClass("choice_bord").addClass("objhide");
				}
				
				if (dels == '[]'){
					$("#divCartItemsRemoved").removeClass("del_merch").addClass("objhide");
				}else{
					$("#divCartItemsRemoved").removeClass("objhide").addClass("del_merch");
				}
				$("#orderLink").click(function(){
				});
				
			});
			function modify(url,pid){
				var sum = $("#sum_"+pid).val();
				var patten = /^[1-9]{1}[0-9]{0,3}$/
				if (patten.test(sum)){
					if (pid>=1){
						window.location=url+sum;
					}
				}else{
					$("#sumerror_"+pid).text("只能输入1-4位>0的数字");
				}
			}
			function clearSumError(pid){
				$("#sumerror_"+pid).text("");
			}
		</script>
	</head>
	<body>&nbsp; 
		<br />
		<br />
		<div class="my_shopping">
			<img class="pic_shop" src="../images/pic_myshopping.gif" />

		</div>
		<div id="div_choice" class="choice_merch">
			<h2 id="cart_tips">
				您已选购以下商品
			</h2>
			<div class="choice_bord" >
				<table class="tabl_buy" id="tbCartItemsNormal">
					<tr class="tabl_buy_title">
						<td class="buy_td_6">
							<span>&nbsp;</span>
						</td>
						<td>
							<span class="span_w1">商品名</span>
						</td>
						<td class="buy_td_5">
							<span class="span_w2">市场价</span>
						</td>
						<td class="buy_td_4">
							<span class="span_w3">当当价</span>
						</td>
						<td class="buy_td_1" >
							<span class="span_w2">数量</span>
						</td>
						<td class="buy_td_2" style="width: 210px;">
							<span>变更数量</span>
						</td>
						<td class="buy_td_1">
							<span>删除</span>
						</td>
					</tr>
					<tr class='objhide' over="no">
						<td colspan="8">
							&nbsp;
						</td>
					</tr>
					
                      <!-- 购物列表开始 -->
                      <s:iterator value="carts">
						<tr class='td_no_bord'>
							<td style='display: none'>
								9317290
							</td>
							<td class="buy_td_6">
								<span class="objhide"><img /> </span>
							</td>
							<td>
								<a href="#">${product.productName}</a>
							</td>
							<td class="buy_td_5">
								<span class="c_gray">￥${product.fixedPrice}</span>
							</td>
							<td class="buy_td_4">
								&nbsp;&nbsp;
								<span>￥${product.dangPrice}</span>
							</td>
							<td class="buy_td_1">
								&nbsp;&nbsp;${sum}
							</td>

							<td >
								<input id="sum_${product.id}" class="del_num" type="text" size="3" maxlength="4" onfocus="clearSumError('${product.id}')"/>
								<a href="javascript:modify('../cart/cartList.action?pid=${product.id}&sum=','${product.id}')">变更</a>
								<span style="color:red;" id="sumerror_${product.id}"></span>
							</td>
							<td>
								<a href="../cart/cartList.action?delPid=${product.id}">删除</a>
							</td>
						</tr>
					</s:iterator>
					<!-- 购物列表结束 -->
				</table>

				<div class="choice_balance">
					<div class="select_merch">
						<a href='../main/main.jsp'> 继续挑选商品>></a>
					</div>
					<div class="total_balance">
						<div class="save_total">
							您共节省：

							<span class="c_red"> ￥<span id="total_economy"><fmt:formatNumber value="${jiesheng}" pattern="#,###.##" /></span>
							</span>
							<span id='total_vip_economy' class='objhide'> ( 其中享有优惠： <span
								class="c_red"> ￥<span id='span_vip_economy'>0.00</span> </span>
								) </span>
							<span style="font-size: 14px">|</span>
							<span class="t_add">商品金额总计：</span>
							<span class="c_red_b"> ￥<span id='total_account'><fmt:formatNumber value="${cost}" pattern="#,###.##" /></span>
							</span>
						</div>
						<div id="balance" class="balance">
							<s:action name="backSession" namespace="/user" executeResult="false">
								<s:param name="back">cartList</s:param>
							</s:action>
							<a name='checkout' href="javascript:checkLogin('../order/orderInfo.action','亲！您还没有登陆 当当网 哦！快去登陆吧...')" id="orderLink" > 
								<img src="../images/butt_balance.gif" alt="结算" border="0" title="结算" />
							</a>
						</div>
					</div>
				</div>

			</div>

		</div>
		<div class="choice_merch">
			<div id="div_no_choice" class="objhide" >
					<div class="choice_title"></div>
					<div class="no_select">
						您还没有<a href='../main/main.jsp' style="font-size:14px;text-decoration:underline ;">挑选商品>></a>
			
					</div>
			</div>					

		</div>
		<!-- 用户删除恢复区 -->


		<div id="divCartItemsRemoved" class="del_merch">
			<div class="del_title">
				您已删除以下商品，如果想重新购买，请点击“恢复”
			</div>
			<table class=tabl_del id=del_table>
				<tbody>
		
				<s:iterator value="dels">
					<tr>
						<td width="58" class=buy_td_6>
							&nbsp;
						</td>
						<td width="365" class=t2>
							<a href="#">${product.productName}</a>
						</td>
						<td width="106" class=buy_td_5>
							￥${product.fixedPrice}
						</td>
						<td width="134" class=buy_td_4>
							<span>￥${product.dangPrice}</span>
						</td>
						<td width="56" class=buy_td_1>
							<a href="../cart/cartList.action?rePid=${product.id}">恢复</a>
						</td>
						<td width="16" class=objhide>
							&nbsp;
						</td>
					</tr>
				</s:iterator>


					<tr class=td_add_bord>
						<td colspan=8>
							&nbsp;
						</td>
					</tr>

				</tbody>
			</table>
		</div>
		<br />
		<br />
		<br />
		<br />
		<!--页尾开始 -->
		<%@include file="../common/foot.jsp"%>
		<!--页尾结束 -->
	</body>
</html>



